/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.just.dusin.ooii.component.standard;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.dusin.webcoal.exception.OOIIException;
import org.just.dusin.ooii.component.Pipe;

import org.just.dusin.ooii.component.kj.DataPackage;
import org.just.dusin.ooii.database.DatabaseConnectionSQL;
import org.just.dusin.ooii.database.MineData;
import org.just.dusin.ooii.database.OrgDao4SQLServer;

/**
 *
 * @author Admin
 */
public class DeviceDataFilterPipe extends Pipe{
    List<String> allowedNoList;
    private static Logger logger = Logger.getLogger(DeviceDataFilterPipe.class.getName());
    

    public void setAllowedNoList(List<String> allowedNoList) {
        this.allowedNoList = allowedNoList;
    }

    @Override
    public void process(String msg) throws OOIIException {
      
         Map map = DataPackage.depackYBSJ(msg);
    
        
        
        
        String no = ((Integer)map.get("no")).toString();
        if(allowedNoList.contains(no)){
            sink.process(msg);
        }else{
            logger.info("丢弃无用消息："+msg);
        }                 
    }

    @Override
    public void process(List<String> msgs) throws OOIIException {        
        for(String msg:msgs){
            process(msg);
        }
    }
}
